package cn.oa.service.impl;

import cn.oa.dao.PositionDao;
import cn.oa.entity.Department;
import cn.oa.entity.Position;
import cn.oa.service.PositionService;
import cn.oa.util.SessionFatoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.sql.SQLException;
import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/3/29 9:06
 **/
public class PositionServiceImpl implements PositionService {
	SqlSessionFactory sessionFactory = SessionFatoryUtil.sessionFactory;
	@Override
	public List<Position> getAllPositions() throws SQLException {
		SqlSession sqlSession = sessionFactory.openSession();
		PositionDao dao = sqlSession.getMapper(PositionDao.class);
		List<Position> list = dao.getAllPositions();
		sqlSession.close();
		return list;
	}
}
